package com.srzk.youthleagueback.controller;

import com.srzk.youthleagueback.pojo.*;
import com.srzk.youthleagueback.results.Result;
import com.srzk.youthleagueback.service.*;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;


import java.util.List;
import java.util.Map;

@CrossOrigin
@RestController
@RequestMapping("/part4")
public class ShowPlatformController {

    @Autowired
    ShowPlatFormService service;

    @GetMapping("/showPlatformList")
    public Result<Map<String,Object>> getList(@RequestParam("user")String user, @RequestParam("year")String year){
        return service.getList(user,year);
    }

    @GetMapping("/showPlatform")
    public Result<Map<String,Object>> get(@RequestParam("user")String user, @RequestParam("year")String year,@RequestParam("id")Long id){
        return service.get(user,year,id);
    }

    @PostMapping("/showPlatform")
    public Result<Map<String,Long>> add(ShowPlat object){
        return service.add(object);
    }

    @DeleteMapping("/showPlatform")
    public Result<String> delete(@RequestParam("user")String user, @RequestParam("year")String year,@RequestParam("id")Long id){
        return service.delete(user, year, id);
    }

    @PostMapping("/showPlatformUpdate")
    public Result<String> update(ShowPlat object){
        return service.update(object);
    }
}
